package com.yy.controller;

import com.yy.pojo.Result;
import com.yy.pojo.bo.CollectionBo;
import com.yy.pojo.vo.ArticleVo;
import com.yy.service.CollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/collection")
public class CollectionController {
    @Autowired
    private CollectionService collectionService;
    //收藏
    @PostMapping
    public Result<String> add(@RequestBody CollectionBo bo) {
        return Result.success(collectionService.add(bo));
    }

    //查询收藏列表
    @GetMapping
    public Result<List<ArticleVo>> list(){
        return Result.success(collectionService.list());
    }
}
